home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / dataform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-07  |  8.5 KB  |  278 lines

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Begin VB.Form frmData 
  4.    Caption         =   "First Impression Formatting Example 2"
  5.    ClientHeight    =   5715
  6.    ClientLeft      =   2100
  7.    ClientTop       =   5205
  8.    ClientWidth     =   8610
  9.    LinkTopic       =   "Form1"
  10.    PaletteMode     =   1  'UseZOrder
  11.    ScaleHeight     =   5715
  12.    ScaleWidth      =   8610
  13.    Begin MSFlexGridLib.MSFlexGrid Grid1 
  14.       Height          =   4455
  15.       Left            =   600
  16.       TabIndex        =   5
  17.       Top             =   1200
  18.       Width           =   5535
  19.       _ExtentX        =   9763
  20.       _ExtentY        =   7858
  21.       _Version        =   327680
  22.       Rows            =   200
  23.       Cols            =   20
  24.    End
  25.    Begin VB.TextBox Text2 
  26.       BeginProperty Font 
  27.          Name            =   "MS Sans Serif"
  28.          Size            =   8.25
  29.          Charset         =   0
  30.          Weight          =   700
  31.          Underline       =   0   'False
  32.          Italic          =   0   'False
  33.          Strikethrough   =   0   'False
  34.       EndProperty
  35.       Height          =   315
  36.       Left            =   6600
  37.       TabIndex        =   2
  38.       Text            =   "Text3"
  39.       Top             =   180
  40.       Width           =   1575
  41.    End
  42.    Begin VB.TextBox TitleBox 
  43.       BeginProperty Font 
  44.          Name            =   "MS Sans Serif"
  45.          Size            =   8.25
  46.          Charset         =   0
  47.          Weight          =   700
  48.          Underline       =   0   'False
  49.          Italic          =   0   'False
  50.          Strikethrough   =   0   'False
  51.       EndProperty
  52.       Height          =   315
  53.       Left            =   720
  54.       TabIndex        =   1
  55.       Top             =   180
  56.       Width           =   4095
  57.    End
  58.    Begin VB.TextBox Text1 
  59.       BeginProperty Font 
  60.          Name            =   "MS Sans Serif"
  61.          Size            =   8.25
  62.          Charset         =   0
  63.          Weight          =   700
  64.          Underline       =   0   'False
  65.          Italic          =   0   'False
  66.          Strikethrough   =   0   'False
  67.       EndProperty
  68.       Height          =   435
  69.       Left            =   720
  70.       TabIndex        =   0
  71.       Text            =   "Text1"
  72.       Top             =   600
  73.       Width           =   7455
  74.    End
  75.    Begin VB.Label Label2 
  76.       Caption         =   "Rows/Cols:"
  77.       BeginProperty Font 
  78.          Name            =   "MS Sans Serif"
  79.          Size            =   12
  80.          Charset         =   0
  81.          Weight          =   700
  82.          Underline       =   0   'False
  83.          Italic          =   0   'False
  84.          Strikethrough   =   0   'False
  85.       EndProperty
  86.       ForeColor       =   &H00FF0000&
  87.       Height          =   315
  88.       Left            =   5040
  89.       TabIndex        =   4
  90.       Top             =   180
  91.       Width           =   1455
  92.    End
  93.    Begin VB.Label Label1 
  94.       Caption         =   "Title:"
  95.       BeginProperty Font 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   9.75
  98.          Charset         =   0
  99.          Weight          =   700
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       ForeColor       =   &H00FF0000&
  105.       Height          =   315
  106.       Left            =   120
  107.       TabIndex        =   3
  108.       Top             =   180
  109.       Width           =   615
  110.    End
  111.    Begin VB.Menu File 
  112.       Caption         =   "File"
  113.       Begin VB.Menu FileOpen 
  114.          Caption         =   "Read VTX file..."
  115.       End
  116.       Begin VB.Menu FileSave 
  117.          Caption         =   "Write VTX file..."
  118.       End
  119.       Begin VB.Menu FSep1 
  120.          Caption         =   "-"
  121.       End
  122.       Begin VB.Menu RCD 
  123.          Caption         =   "Read Internal Chart Data..."
  124.       End
  125.       Begin VB.Menu WCD 
  126.          Caption         =   "Write Internal Chart Data..."
  127.       End
  128.       Begin VB.Menu FileClose 
  129.          Caption         =   "Close..."
  130.       End
  131.    End
  132.    Begin VB.Menu Refresh 
  133.       Caption         =   "Refresh"
  134.       Begin VB.Menu RCDG 
  135.          Caption         =   "Refresh Chart With Data Grid"
  136.       End
  137.    End
  138. Attribute VB_Name = "frmData"
  139. Attribute VB_GlobalNameSpace = False
  140. Attribute VB_Creatable = False
  141. Attribute VB_PredeclaredId = True
  142. Attribute VB_Exposed = False
  143. Option Explicit
  144. Private Sub FileClose_Click()
  145.     frmData.Hide
  146.     frmMain.show
  147. End Sub
  148. Private Sub FileOpen_Click()
  149.     Dim TheFileName$
  150.     On Error Resume Next
  151.     frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
  152.     frmMain.CommonDialog1.DialogTitle = "Open"
  153.     frmMain.CommonDialog1.flags = &H1000
  154.     frmMain.CommonDialog1.CancelError = True
  155.     frmMain.CommonDialog1.InitDir = App.Path
  156.     frmMain.CommonDialog1.Action = 1
  157.     If Err Then Exit Sub
  158.     TheFileName = frmMain.CommonDialog1.filename
  159.     Call QReadData(TheFileName)
  160. End Sub
  161. Private Sub FileSave_Click()
  162.     Dim theRow%, theCol%
  163.     Dim TheRowCount%, TheColCount%
  164.     On Error Resume Next
  165.     frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
  166.     frmMain.CommonDialog1.DialogTitle = "Save As"
  167.     frmMain.CommonDialog1.flags = &H2
  168.     frmMain.CommonDialog1.CancelError = True
  169.     frmMain.CommonDialog1.filename = Left$(GlobalFileName, Len(GlobalFileName) - 1) + "x"
  170.     frmMain.CommonDialog1.Action = 2
  171.     If Err Then Exit Sub
  172.     Open frmMain.CommonDialog1.filename For Output As #1
  173.     If Err Then
  174.         MsgBox "Can't open file: " + frmMain.CommonDialog1.filename
  175.         Exit Sub
  176.     End If
  177.     TheColCount = 1
  178.     TheRowCount = 1
  179.     For theRow = 1 To 200
  180.         For theCol = 1 To 10
  181.             Grid1.Row = theRow
  182.             Grid1.Col = theCol
  183.             If Len(Grid1.Text) > 0 Then
  184.                 If theCol > TheColCount Then TheColCount = theCol
  185.                 If theRow > TheRowCount Then TheRowCount = theRow
  186.             End If
  187.         Next theCol
  188.     Next theRow
  189.     ' Write the new file to disk
  190.     Dim Quote$
  191.     Quote = Chr$(34)
  192.     Print #1, Quote + "VisualTools Chart Data" + Quote
  193.     Print #1, Quote + "Title" + Quote, Quote + TitleBox.Text + Quote
  194.     Print #1, Quote + "Rows" + Quote, Str$(TheRowCount)
  195.     Print #1, Quote + "Cols" + Quote, Str$(TheColCount)
  196.     For theRow = 1 To TheRowCount
  197.         For theCol = 1 To TheColCount
  198.             Grid1.Row = theRow
  199.             Grid1.Col = theCol
  200.             Print #1, Format$(theRow, "##0"), Format$(theCol, "##0"), Quote + Grid1.Text + Quote
  201.         Next theCol
  202.     Next theRow
  203.     Close #1
  204. End Sub
  205. Private Sub Form_Activate()
  206.     Text1.SetFocus
  207. End Sub
  208. Private Sub Form_Load()
  209.     frmData.Height = 7200
  210.     frmData.Width = 9615
  211.     frmData.Top = 0
  212.     frmData.Left = 0
  213.     Text1.Text = Grid1.Text
  214.     Grid1.Row = 1
  215.     Grid1.Col = 1
  216. End Sub
  217. Private Sub Form_Resize()
  218.    Grid1.Width = ScaleWidth - 120
  219.    Grid1.Height = ScaleHeight - Text1.Top - Text1.Height - 150
  220. End Sub
  221. Private Sub Form_Unload(Cancel As Integer)
  222.     frmData.Hide
  223.     frmMain.show
  224.     Call RefreshChart
  225.     Cancel = 1
  226. End Sub
  227. Private Sub Grid1_SelChange()
  228.     Text1.Text = Grid1.Text
  229.     Text1.SetFocus
  230. End Sub
  231. Private Sub RCD_Click()
  232.    On Error GoTo FileReadError
  233.    With CommonDialog1
  234.       .DialogTitle = "Read First Impression Data"
  235.       .DefaultExt = "vtx"
  236.       .Filter = "First Impression Data|*.vtx"
  237.       .flags = &H1000
  238.       .CancelError = True
  239.       .InitDir = App.Path
  240.       .ShowOpen
  241.       
  242.       Call QReadData(.filename)
  243.    End With
  244.    Exit Sub
  245. FileReadError:
  246.    MsgBox Error
  247. End Sub
  248. Private Sub RCDG_Click()
  249.     Call RefreshChart
  250. End Sub
  251. Private Sub RefreshChart()
  252.     Dim TheRowCount%, TheColCount%, theRow%, theCol%
  253.     ' Dermine the new Row and Column count
  254.     TheRowCount = 1
  255.     TheColCount = 1
  256.     For theRow = 1 To 200
  257.         For theCol = 1 To 35
  258.             frmData.Grid1.Row = theRow
  259.             frmData.Grid1.Col = theCol
  260.             If frmData.Grid1.Text <> "" Then
  261.                 If theRow > TheRowCount Then TheRowCount = theRow
  262.                 If theCol > TheColCount Then TheColCount = theCol
  263.             End If
  264.         Next theCol
  265.     Next theRow
  266.     Call QGridToChart(TheRowCount, TheColCount)
  267. End Sub
  268. Private Sub Text1_KeyPress(KeyAscii As Integer)
  269.     If KeyAscii = 13 Then
  270.         Grid1.Text = Text1.Text
  271.         KeyAscii = 0
  272.     End If
  273. End Sub
  274. Private Sub WCD_Click()
  275.     ' Write the data in the chart to a file
  276.     Call QWriteData
  277. End Sub
  278.